<?php
 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Mauthentic extends MY_Model
{
    public function __construct()
    {
        parent::__construct();
    }
    
    
    public function loginAdmin()
    {
        $uname = strtolower($this->getParamString('username'));
        $upass = $this->getParamString('password');
        $sql = $this->db->query("SELECT * FROM nguoidung WHERE tendangnhap = '".$uname."' AND matkhau = '".$upass."' ");
        if($sql->num_rows() > 0)
        {
            $data = $sql->row();
            $data = array(
                'admin_id' => $data->manguoidung,
                'username' => $data->tendangnhap,
                'fullname' => $data->hoten,
                'level' => $data->capdo
            );
            $this->session->set_userdata($data);
            return '200';
        }
        return '202';
    }
}